#PyQt5 Label
Explore tagged Tumblr posts
pythonturkiye-blog · 8 years ago
Text
PyQt5 Etiket ve Yazı alanları - Devamı
New Post has been published on http://www.python.tc/pyqt5-etiket-ve-yazi-alanlari-devami/
PyQt5 Etiket ve Yazı alanları - Devamı
Bugün ikinci bölüm olarak belirlediğim Etiket ve Yazı alanları kısmını yazıyorum.
Bu bölüm ile yavaş yavaş oluşturduğumuz pencerelerin içini doldurmaya başlayacağız.
Şimdi penceremizi oluşturmaya başlayalım.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() app = QApplication(sys.argv) window = Window() window.show() app.exec_()
Geçen bölümde gösterdiğim class yapısı ile penceremizi oluşturduk. Şimdi label(etiket) kullanımını öğrenelim.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #ilk label oluşturma örneğimiz self.etiket = QLabel("deneme",self) app = QApplication(sys.argv) window = Window() window.show() app.exec_()
ikinci örnekte ise kullanımını setText(“text”) methodu yardımıyla yapabilirsiniz.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #basit bir grid oluşturalım self.grid = QVBoxLayout(self) # Etiket oluşturma #örnek 2 self.etiket2 = QLabel(self) self.etiket2.setText("deneme2") #addwidget aracıyla alt alta getirelim app = QApplication(sys.argv) window = Window() window.show() app.exec_()
İkisi arasında hiçbir fark yoktur. Aşağıdaki kod bloğuna dikkat ederseniz sizin için daha iyi olacaktır.
note: ufak bir grid yapısı kullanıldı sebebi yazıların üst üste gelmesinden dolayı.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #basit bir grid oluşturalım self.grid = QVBoxLayout(self) # Etiket oluşturma #örnek 1 self.etiket = QLabel("deneme",self) #örnek 2 self.etiket2 = QLabel(self) self.etiket2.setText("deneme2") #addwidget aracıyla alt alta getirelim self.grid.addWidget(self.etiket) self.grid.addWidget(self.etiket2) app = QApplication(sys.argv) window = Window() window.show() app.exec_()
  setText metoduyla sonradan label isimlerini değiştirebilirsiniz.
self.etiket.setText("deneme3")
  LineEdit
Bu kısımın bir aksiyonu olmadığı için direk kodlarla gösteriyorum. QlineEdit ile rahatçaHtmldeki input benzeri bir alanı oluşturuyoruz.
self.lineEdit = QLineEdit(self)
Eğer derseniz ki şifre korumasını nasıl yaparım diye setEchoMode ile input alanının şifre için ayarlayabilirsiniz.
self.lineEdit.setEchoMode(QLineEdit.Password)
  Şimdi isterseniz ufak bir giriş alanı oluşturalım. uyarı olarak QtDesigner ile yapacağım için sadece label ve lineEdit alanlarına dikkat etmeniz yeterli.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #basit bir grid oluşturalım self.grid = QVBoxLayout(self) #labelları oluşturalım self.label_ad = QLabel("Kullanıcı adı: ",self) self.label_sifre = QLabel("Şifre: ",self) #lineEdit(input) alanlarını oluşturalım self.ad=QLineEdit(self) self.sifre=QLineEdit(self) #şifre alanını ayarlayalım örn:**** self.sifre.setEchoMode(QLineEdit.Password) #ufak bir grid ayarı ile artık düzenli bir görüntü alabiliriz. self.grid.addWidget(self.label_ad) self.grid.addWidget(self.ad) self.grid.addWidget(self.label_sifre) self.grid.addWidget(self.sifre) app = QApplication(sys.argv) window = Window() window.show() app.exec_()
  Ufak ufak artık kendimizi geliştiriyoruz.  Bir sonraki yazımızda  listeler, combobox alanları ‘nı göreceğiz. Bugün buttonlarla ilgili yazıları yazıp artık daha güzel örneklerle ilerleyeceğiz.
İyi günler 🙂
1 note · View note
hydrus · 4 years ago
Text
Version 439
youtube
windows
zip
exe
macOS
app
linux
tar.gz
I had an ok week. The new tiled renderer is improved.
tiled renderer
The new image drawing system generally worked well! There were a couple of bugs, and it still has some limitations, but in general it really improved zoom and precache performance.
For the bugs, first of all, there was a rare crash, I think triggered by loading a very unlucky coincidence of tile and image size. Then clipboard bitmap copy threw an error, tiny images could not deal with extremely small zoom, and clients under heavy load could sometimes have trouble initialising the viewer. I have fixed them all, but let me know if you have any more trouble!
There was also a problem with PyQt5, an alternative version of the Qt UI library that some 'running from source' users use. It was an object handling difference between PyQt5 and PySide2 that broke the tile caching system. I think I have fixed it, so if you are running PyQt5, please give this version a go.
Beyond bugs, there were tiling artifacts visible at higher zooms. Essentially, where the tiles lined up, there were small disagreements in resize math, resulting in little lines of mismatching colour gradients along tile borders. I worked on the tiling algorithm and have significantly mitigated the problem--I mostly only see artifacts at extreme zooms now, about 2000%.
Since people are suddenly zooming more, users who have mouse-centered zooming were having more images accidentally flying off screen too. I've hacked in off-screen rescue after a zoom, sliding it back to the nearest border, so the image should always stay in view. If people like it, I may patch this in for all media for dragging events too. There's not much need for non-visible media, and when it does happen it can sometimes be a pain dragging around to find where it went.
I hope this basically makes the tile render a complete '1.0' now. In the future, I would like to rejigger some of the virtual geometry, since at the moment a limit in Qt means I cannot zoom higher than a 'virtual' 32,768x32,768 canvas (e.g. 4k at about 800% zoom). I'll also replicate the tiling for my native Animation widget, which displays gifs and video when mpv is not available.
full list
tiled image renderer improvements:
I believe I fixed the 'non c-contiguous' crash issue with the new tile renderer. I had encountered this while developing, but it was still happening in rare situations--I _think_ in an unlucky edge case where a zoomed tile had the same resolution as the full image rotated by ninety degrees! there is now an additional catch for this situation, as well, to catch any future logical holes.
fixed a bug in the new renderer when copying an image to clipboard
I greatly mitigated the tiling artifacts with two changes:
- zoomed in tiles are now resized with a padding area of up to 4 pixels, with the actual tile cropped afterwards, which allows bilinear and lancsoz interpolation to get accurate neighbour data and have gradient math line up with neighbouring tiles more accurately
- on resize and zoom, media canvases now dynamically change tile size to 'neater' float/integer conversion dimensions to reduce sub-pixel panning alignment artifacts (e.g. if your zoom is 300%, the tile is now going to have a dimension that is a multiple of 3)
I hacked in a 'rescue offscreen media' calculation after any zoom event. now, if the window is completely out of view after a zoom, it'll snap to the nearest borders, lining against them or overlapping into a buffer zone depending on the zoom. let me know what you think!
I fixed a PyQt5 specific object tracking bug, I think the new renderer now works ok for PyQt5!
cleaned up some ugly code in the resize section that may have been resulting in incorrect interpolation algorithm choice in some situations
fixed a divide by zero issue when zooming out tiny images hugely (e.g. 32x32 at 1%)
media windows now try to have at least 1x1 size, just to catch some other weird error situations
similarly, tile and native sample sizes will have a minimum of size 1x1, which should fix issues during a delayed startup (issue #872)
cleaned up some misc media viewer and tile renderer code
.
the rest:
I started the next round of database optimisation tech, mostly testing out a pipeline upgrade. autocomplete fetching and wildcard file searching for very large queries should be a little faster to cancel now, and in some situations they should be a little faster. they may be slower for very small jobs, but I expect it to be unnoticeable. if you feel autocomplete is suddenly slow and laggy, let me know!
I optimised the basic 'ideal sibling normalisation' database query. this is used in a lot of places, so the little saving here should improve a bunch of work
I greatly optimised autocomplete sibling population, particularly for searches with a lot of tag results
I brushed up the tag import options UI: changed the 'use defaults' checkbox to a dropdown with clear labels for both modes; renamed the 'fetch tags even if' tag import options to 'force page fetch', which is a better description, and added tooltips to describe their ideal use; added tooltips to blacklist and whitelist; and hid the 'load from defaults' button if not set to view specific options
added a 'imgur single media file url' File URL Class, which points to direct file links without a referral header, which should fix some situations where these urls were pointed to by other site parsers
collections now store the _most recent_ import timestamp of their contents as the aggregate for time imported. previously they had no value, so would sort randomly with each other. collections therefore now sort by time imported reliably with each other, even if there is no 'correct' answer here
these new timestamps and service presence generally, and aggregated archive/inbox status, (all of which can update thumbnail display) is now recalculated when files are removed from the collection. so, hitting _right-click->remove->inbox_ will now update collections with a mix of archived and inboxed to remove the inbox icon immediately
as the "Retry has no attribute..." network errors have appeared in new forms, I gave the core of the problem another look. we could never really figure this out, but it seemed to be a network version thread safety issue. I think I have ruled this out, and I now believe these may have been occuring during faulty pickling during network session save/load. I fixed the problem here, so with luck this issue will not reappear--if you have had this a lot, let me know how you get on!
I broke the requirements.txt into several variants based on platform. we are going to try to pin down good fixed versions of python-mpv and requests/urllib3 for each platform
I also updated the 'running from source' help significantly, moving everything to the requirements.txt and making sections for things like FFMPEG and libmpv
Also updated the source and contact help around my work style and contact preferences
the test.py file now only does the final input() confirmation if there is an interactive stdin to respond
next week
Next week is code cleanup and some little jobs that have slipped through the cracks. Nothing too clever, but I want to fit in some misc boring work.
Thanks everyone!
0 notes
clayatlas · 6 years ago
Text
PyQt5 基本教學 (2) QLabel, QLineEdit, QPushButton
PyQt5 基本教學 (2) QLabel, QLineEdit, QPushButton
Tumblr media Tumblr media
PyQt5 基本教學 (1) 安裝 PyQt5,印出 Hello World!
PyQt5 基本教學 (2) QLabel, QLineEdit, QPushButtom
【簡介】
今天,我想要將我嘗試 PyQt5 裡頭 Label、LineEdit、PushButton 的經驗記錄下來。順帶一題,目前維止都還是倚靠 Qt Designer 來拉出界面。
也許總有一天必須自己撰寫界面原始碼(畢竟 Qt Designer 裡頭的元件其實並不完整,當然也或許只是我沒找到),希望能持續堅持學習到那天!
一如既往,如果你想參閱官方指南,也許你可以參考:
https://www.riverbankcomputing.com/static/Docs/PyQt5/index.html?highlight=qicon
(more…)
View On WordPress
0 notes
pythonturkiye-blog · 8 years ago
Text
Etiket ve Yazı alanları
New Post has been published on http://www.python.tc/etiket-ve-yazi-alanlari/
Etiket ve Yazı alanları
Bugün ikinci bölüm olarak belirlediğim Etiket ve Yazı alanları kısmını yazıyorum.
Bu bölüm ile yavaş yavaş oluşturduğumuz pencerelerin içini doldurmaya başlayacağız.
Şimdi penceremizi oluşturmaya başlayalım.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() app = QApplication(sys.argv) window = Window() window.show() app.exec_()
Geçen bölümde gösterdiğim class yapısı ile penceremizi oluşturduk. Şimdi label(etiket) kullanımını öğrenelim.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #ilk label oluşturma örneğimiz self.etiket = QLabel("deneme",self) app = QApplication(sys.argv) window = Window() window.show() app.exec_()
ikinci örnekte ise kullanımını setText(“text”) methodu yardımıyla yapabilirsiniz.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #basit bir grid oluşturalım self.grid = QVBoxLayout(self) # Etiket oluşturma #örnek 2 self.etiket2 = QLabel(self) self.etiket2.setText("deneme2") #addwidget aracıyla alt alta getirelim app = QApplication(sys.argv) window = Window() window.show() app.exec_()
İkisi arasında hiçbir fark yoktur. Aşağıdaki kod bloğuna dikkat ederseniz sizin için daha iyi olacaktır.
note: ufak bir grid yapısı kullanıldı sebebi yazıların üst üste gelmesinden dolayı.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #basit bir grid oluşturalım self.grid = QVBoxLayout(self) # Etiket oluşturma #örnek 1 self.etiket = QLabel("deneme",self) #örnek 2 self.etiket2 = QLabel(self) self.etiket2.setText("deneme2") #addwidget aracıyla alt alta getirelim self.grid.addWidget(self.etiket) self.grid.addWidget(self.etiket2) app = QApplication(sys.argv) window = Window() window.show() app.exec_()
  setText metoduyla sonradan label isimlerini değiştirebilirsiniz.
self.etiket.setText("deneme3")
LineEdit Bu kısımın bir aksiyonu olmadığı için direk kodlarla gösteriyorum. QlineEdit ile rahatçaHtmldeki input benzeri bir alanı oluşturuyoruz.
self.lineEdit = QLineEdit(self)
Eğer derseniz ki şifre korumasını nasıl yaparım diye setEchoMode ile input alanının şifre için ayarlayabilirsiniz.
self.lineEdit.setEchoMode(QLineEdit.Password)
  Şimdi isterseniz ufak bir giriş alanı oluşturalım. uyarı olarak QtDesigner ile yapacağım için sadece label ve lineEdit alanlarına dikkat etmeniz yeterli.
from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): super().__init__() #basit bir grid oluşturalım self.grid = QVBoxLayout(self) #labelları oluşturalım self.label_ad = QLabel("Kullanıcı adı: ",self) self.label_sifre = QLabel("Şifre: ",self) #lineEdit(input) alanlarını oluşturalım self.ad=QLineEdit(self) self.sifre=QLineEdit(self) #şifre alanını ayarlayalım örn:**** self.sifre.setEchoMode(QLineEdit.Password) #ufak bir grid ayarı ile artık düzenli bir görüntü alabiliriz. self.grid.addWidget(self.label_ad) self.grid.addWidget(self.ad) self.grid.addWidget(self.label_sifre) self.grid.addWidget(self.sifre) app = QApplication(sys.argv) window = Window() window.show() app.exec_()
  Ufak ufak artık kendimizi geliştiriyoruz.  Bir sonraki yazımızda  listeler, combobox alanları ‘nı göreceğiz. Bugün buttonlarla ilgili yazıları yazıp artık daha güzel örneklerle ilerleyeceğiz.
İyi günler 🙂
0 notes
hydrus · 4 years ago
Text
Version 438
youtube
windows
zip
exe
macOS
app
linux
tar.gz
Hey, this causes errors if you are running from source and using PyQt5 (PySide2 is fine)! All the releases above are PySide2, so they are ok! I will fix this for next week, so if you are source+QtPy5, please hold off for now.
I had a great week overhauling the media viewer's image rendering. Zooming and navigation should be a lot smoother now!
image tiles
tl;dr: the media viewer now zooms and navigates with less lag and flicker
Zooming in a long way, particularly for large images, has been pretty hellish for as long as the program has existed. Historically, the client drew the whole image in memory at the zoom you desired so it could quickly show you the bit it needed on screen. Of course this meant zooming in to 400% on anything above 4k was suddenly taking a very long time to set up and eating a lot of memory to do it. As images have naturally grown over time, the problem has occurred more often and was starting to affect other systems.
My plan to fix this has been to break the image into tiles that then render on demand. The parts of the image off-screen are never drawn, saving CPU and memory and allowing arbitrary zoom. This is a significantly more complicated idea, and rewriting the whole rendering pipeline was always expected to be a multi-week 'big job'. I originally planned to just optimise and tweak the secondary systems and add in some sanity brakes this week, but I ran a couple of small tiling tests and realised if I went bonkers it would be possible to hack in a prototype. So I did!
In the media viewer, images now draw in tiles. It works a little like a browseable satellite map, where when you zoom in and pan about you see squares of data fading in (except in hydrus they appear instantly). You should now be able to zoom in as far as you like on an image pretty quick and you won't have any sudden memory needs.
Furthermore, I have written a cache for these image tiles. This saves CPU when revisiting different images or zooms, so when you flick back and forth between two normal things, it should now be instant! It still takes 20-200ms to view or zoom most images the first time, but going back to that view or zoom within a minute or so should be really smooth. The cache starts at a healthy 256MB this week. I think that will cover most users very well (in screen real estate, it works out to about 35 x 1080p worth of tiles), but you can alter it under the settings at options->speed and memory.
And I did some misc work improving the rendering pre-fetch logic when you browse in the media viewer. Huge files won't stomp all over the image renderer cache any more, which should make browsing through a series of giant images far less jank. If you are feeling advanced, you can now edit the prefetch timing and distance settings too, also under options->speed and memory.
I am really pleased with this week's work, but there are some drawbacks: I did it quick, so I cannot promise it is good. The most obvious bug already is that at around 200-500% zoom you start to see tiling artifacts. I know what causes this (interpolation algorithms not getting full pixel neighbour data from my simple tesselating tiles) and have a plan to fix it (adding a tile border pre-resize, and then cropping). There is also an issue when the 'virtual' image exceeds about 32,000x32,000, so I hacked a zoom block for that. There may be some weird files that render with other stitching artifacts or bad tile data. Note also that hydrus's 'Animation' renderer (the soundless fallback if you do not have mpv support) does NOT use tiling yet, so it still sucks at zooming! Please let me know how you get on!
If you have a steam-powered GPU or a machine with only 4GB of ram, you might like to wait for 439 so I can address any surprise bugs or performance issues.
PTR and account permissions
The PTR is changing how its accounts work. The shared public account is transforming to a 'read-only' account that can only download, so if you want to upload, you'll be going to manage services to auto-create your own privileged account. This is being done to improve janitor workflow for the various petitions, which were all being merged together because of the shared account. With the recent network updates, it will soon be easier for janitors to send simple messages back to these individual accounts, like 'that proposed sibling was not approved because...'.
Unfortunately, various permission and account-management code has not been tested much until now, so as the PTR guys have been trying this stuff out, I have been working to improve bad notifications and workflows. This week I rounded out account permissions testing with uploading. Hydrus no longer tries to upload content the current account does not have permission for, and if you end up in that situation, popup messages now tell you what is going on. It also catches if your account is currently 'unsynced', with instructions to fix.
Similarly, under 'manage siblings/parents', you can now see and edit all tag repositories (previously, they were hidden if you currently had no permission), but you get a label telling you if you don't have permission.
full list
media viewer:
I have hacked in tile-based image rendering for the media viewer. this has always been planned as a larger, longer-term job, but the problem of large images is only getting worse, so I decided to just slam out a prototype in a week. if you have a steam-powered GPU or 4GB ram, you might like to wait until next week to update so I can iron out any surprise bugs or performance problems
images are now cut into tiles that are rendered on demand, so whenever the image is zoomed larger than the media viewer window, only those tiles currently in view have CPU and memory spent on resizing and storage. as you pan around, new tiles are rendered as needed, and old discarded. this makes zooming in super fast and low memory, even for large images!
although I am happy with this, and overall we are talking a huge improvement on previous performance, it is ugly fast code. it may fail for some unusual files. it slices and blits bitmaps around your video memory much faster than before, so some odd GPUs may also have problems. I haven't seen any alignment artifacts (1-pixel thick missing columns or rows), but some images may produce them. more apparent are some pretty ugly tile artifacts that show up between 200% and 500% zoom (interpolation algorithms, which rely on neighbour pixels, are missing border data with my simple system). I will consider how best to implement more complicated but stitch-correct overlapping tiles in future
futhermore, a new 'image tile' cache is added. you can customise size and timeout under _options->speed and memory_ like for images and thumbnails. this is a dedicated cache for remembering image resize computation across images and zooms. once you have seen both situations once, flicking back and forth between two images or zoom levels is now generally always instant! this new cache starts at a healthy default of 256MB. let's see how that amount works out IRL--I think it will be plenty
I tuned the image renderer cache--it no longer caches huge images that eat more than 25% its total size--meaning these images only hang around as long as you are looking at them--and the prefetch call that pre-renders several files previous/next to the current image no longer occurs on images that would eat more than 10% the cache size. this should greatly reduce weird flicker and other lag when browsing through a series of mega-images (which before would stomp through the cache in quick succession, barging each other out of the way and wasting a bunch of CPU). in real world terms, this basically means that with an image cache of 200MB, you should have slower individual image performance but much better overall performance looking at images with more than about 5k resolution. the dreaded 14,000x12,000 png will still bonk you on the head to do the first render, but it won't try to uselessly prefetch or flush the whole cache any more
if you are currently looking at a static image, neighbour prefetch now only starts once the image is rendered, giving the task in front of you a bit more CPU time
new options for prefetch delay and previous/next distance are added to 'speed and memory'
note this does not yet apply to the old hydrus animation renderer. that still sucks at high zoom!
another future step here is to expand prefetch to tiles so the first view of the 'next' media is instant, but let's let all this breathe for a bit. if you get bugs, let me know!
due to a Qt issue, I am stopping zoom-in events that would make the 'virtual' size of the image greater than 32,000x32,000
.
account permission improvements:
to group sibling and parent petitions by uploader (and thus help janitor workflow), the PTR is moving to a system where the public account is download-only and accounts that can upload content are auto-generated in manage services. this code has not been tested much before, and it revealed some very bad reporting and handling of current permissions. I move this forward this week:
if your repository account is currently unsynced from a serious previous error, any attempt to upload pending data will result in a little popup and the upload being abandoned
manage tag siblings and parents will now show service tabs even if the account for those services does not seem currently able to upload tags or siblngs
if your repository account is currently unsynced from a serious previous error, this is now noted in red text in manage siblings and manage parents
if your repository account does not have sibling/parent upload permission, this is now noted in red text in manage siblings and manage parents. you will be able to pend and petition siblings and parents ok
if your repository account does not have mapping/sibling/parent upload permission of the right kind, your client will no longer attempt to upload these content types, and if there is pending count for one of these types, a popup will note this on an upload attempt
.
the rest:
added https://github.com/NO-ob/LoliSnatcher_Droid to the Client API help!
improved some error handling, reporting, and recovery when importing serialised pngs. specific error info is now written to the log as well
fixed a secondary error when dropping non-list, non-downloader pngs on Lain's easy downloader import window, and fixed a 'no interesting objects' reporting test when dropping multiple pngs
added a 'cache report mode' to help debug image and thumb caching issues
refactored the media viewer code to a new 'canvas' submodule
improved the error reporting when a thumbnail cannot be generated for a file being imported
fixed an error in zoom center calculation when a change zoom event was sent in the split-second during media viewer initialisation
I think I fixed an issue where pages could sometimes not automatically move on from 'loading initial files' statusbar text when initialising the session
the requirements.txt now specifies 'requests' 2.23.0 exactly, as newer versions seemed to be giving odd urllib3 attribute binding errors (seems maybe a session thread safety thing) when recovering from connection failures. this should update the macOS build as well as anyone running from source who wants to re-run the requirements.txt. I hacked in a catch for this error case anyway, just a manual retry like a normal connection error, we'll see how it goes (issue #665)
patched an unusual file import bug for a flash file with an inverted bounding box that resulted in negative reported resolution. flash now takes absolute values for width and height
next week
Back to multiple local file services. Mostly more backend cleanup and prepping File Import Options and the Client API for talking to multiple locations.
0 notes
hydrus · 6 years ago
Text
Version 374
youtube
windows
zip
exe
macOS
app
linux
tar.gz
source
tar.gz
I had a great week. A ton of Qt problems are fixed, and a macOS App is ready. If you were waiting for a cleaner release, I would recommend this for all Windows and Linux users.
Qt
I mostly worked this week on Qt bugs. I appreciate all the reports everyone sent in. I have fixed a whole lot, mostly bringing things back in line to where the wx build was. The whole list is in the changelog, but the highlights are:
Fixed the cursor not unhiding in the media viewer as long as it was over a media.
Fixed the resizing texts that were causing subscription popups and others to bounce around.
Fixed pages auto-resorting media on creation when not desired.
Fixed tab drag and drop when 'do not follow' (+shift) mode is on.
File drag and drop to discord should be fixed on Windows if the options->gui BUGFIX is set.
Added basic high DPI scaling support--all feedback appreciated. -- EDIT: It looks like high dpi scaling is making thumbs and media viewer unintentionally scale up in a pixelly way on some machines. I will put time into this week and see if I can get them looking better for 375.
Fixed some memory leaks.
There is still some stuff I didn't have time to get to--some layout/sizing problems for dialogs, some splitter/sash positioning issues, focus sometimes not transferring when requested, and some weirder stuff like html rendering as a web document in text labels rather than displaying literally. I'll keep going, but the vast bulk of the work is done.
macOS and Linux builds
I fixed a critical issue in the macOS build and believe I have it working as good as the others. If you are a macOS user who has a backup, please give it a go and let me know what you get. If you want a confirmed clean release, please wait a week. Some things like maximised media viewers are a little janky, so I'm interested in feedback on what you see and what you would like it to do instead, if anything. I have disabled borderless fullscreen for now for similar reasons. Also, the centered tab bar for regular pages has thrown off all the tab drag and drop position calculations, so tab rearrange and intra-client file drag and drops are disabled--I'll put some time into it next week and see if I can fix it.
The Linux build now has some common library files removed. This should improve font compatibility for some users by causing hydrus to rely on your higher compatibility system libraries rather than the ones on my dev machine. If you use the built release and have the wrong font or other UI jank, please try doing a semi 'clean' install this week by deleting all the .so files in your base install directory (the ones beside the 'client' executable) before extracting as you normally would. If you try this, make sure you have a backup beforehand, just in case you accidentally delete the wrong thing.
Arch users who run from source may have been unable to run the client due to 'shiboken' issues. This is because Arch recently updated to Python 3.8, where PySide2 (a Qt wrapper) does not currently work! Some updated running-from-source instuctions on how to use PyQt5 instead are now here: https://hydrusnetwork.github.io/hydrus/help/running_from_source_linux_packages.txt
full list
qt environment/build:
macOS build is useable! tab drag and drop position calculation doesn't work yet, so intra-client file DnDs and tab rearrange DnDs are disabled for now. borderless fullscreen is also disabled, feedback on this vs maximise would be appreciated
fixed a critical bug in the macOS release that was resulting in 100% CPU repaint loop for the canvas viewer when media was loaded (wew). this may have affected certain other platforms in some situations
the linux build has a variety of common library files removed, letting your OS rely on higher compatibility system defaults. this _should_ clean up font and other issues for users running on very new/old system libraries. if you cannot run 374, please let me know your distro and version and any error messages
the special linux running from source document is updated, including info about Arch and PyQt5
fixed a windows build issue that meant some animated gifs were not able to load and render correctly
fixed a precise time fetching issue for users running from source with python 3.8
high dpi scaling should have improved support. please report on bad layout issues and other artifacts
fixed creating a serialised object png when using PyQt5
fixed file save dialogs with filetype filters when using PyQt5
fixed an important menubar related memory leak
_seem_ to have fixed an important media viewer memory leak
.
qt ui fixes:
fixed pages not collecting and sorting on creation if they do not have to, which restores the 'preserve flat unsorted order' behaviour of session loads and file drag and drop page tab creations
fixed the cursor not unhiding on move in the media viewer when over an animation or static image
fixed the issue where a new thumbnail panel would double-up with the old one for half a second if a menu caused the panel swap
reworked the elided (text that cuts off...) label code to more reliably work on single lines, which fits our purposes. the network job control (esppecially on subscription popups) and top hover window should now show their long statuses without changing their parent panel's layout
updated a variety of old text-wrap-width wx-hacks texts to instead auto-fill available space
the various downloaders should now be careful about handling large status texts. if a multiline error or html page slips in to a status somewhere, your download pages' lists should no longer go nuts with very tall spam-filled status cells
hydrus->discord drag and drop should be fixed if the BUGFIX is on!
fixed page tab drag and drop to do live drag selection with 'do not follow' behaviour (this is switched by holding down shift during drag), and, in this case, got it to return to the original page's neighbour/parent once the drop is complete
fixed 'center' dialogs positioning on the center of their parent windows, rather than the center of the primary screen
fixed the hover windows not passing shortcuts up to the media viewer when not consumed
fixed some misc 'can I consume a shortcut' focus/active checking code
fixed the various hide/parents/siblings tag menu items for tags with counts
fixed the main gui and other non-dialog windows remembering their pre-maximise/fullscreen sizes if set to remember size and previously closing while maximised/fullscreened
menubar menus should now show description text in the main gui statusbar on mouseover of their items
fixed a bad menu initialisation in the canvas preview panel
fixed a little page splitter bork and improved size of preview window on initial boot
fixed the edit notes dialog when launched from the media viewer
fixed a couple of text edit issues in edit url class panel
fixed page up/down scroll for taglists
fixed page down scroll for thumbnail grid, and fixed page up/down distance
fixed thumbnails not scrolling into view if they are keyboard-selected slightly off screen but within the scroll option percentage threshold
misc layout and style cleanup
misc refactoring
.
misc:
you can now set the maximum size of duplicate filter pair batches (default 250) under options->duplicates
when an ipfs service fails to pin a file and returns no hash or the empty multihash, this is now recognised, info dumped to log, a simple popup message sent, and the job continued. this is just a patch--better error handling here will come later
if the client or server are launched with a custom temp_dir that does not exist, it will now attempt to create it (previously errored out)
fixed a clean exit after certain client boot fail error handling, and repeated cleaner exit for the server
added some new memory profiling actions to the help->debug menu
parallel subscriptions should now initialise with less of an aggresive CPU spike
if the client or server crash before the application can be launched, the crash log is now called hydrus_crash.log. if the db dir is not yet established, it will now try to find and put it in your desktop and, failing that, then your user dir
the client no longer prints 'booting db' twice
a variety of misc code cleanup and fixes
next week
I was going to take an easy week, but I ended up crunching again, ha ha, so I'll for real take it a bit easier this coming week. There's still some Qt stuff to fix, and doubtless a few more reports to come in, and Qt css theming to add, but I'd also really like to get back to doing some normal work. There's a thousand things to do, so one part of it will just be going through my list and triaging the most important stuff.
As we get to the end of the year, I would like to finish some tag work like namespace siblings and tag filters on uploading and tag processing, and also try getting this mpv window embedded into the media viewer so we have full-featured video and legit audio support. My ideal is to have the 'emergency' tag work complete for February so I can put up a new 'big job to work on next' poll.
0 notes
hydrus · 5 years ago
Text
Version 384
youtube
windows
zip
exe
macOS
app
linux
tar.gz
source
tar.gz
I had a great week updating the shortcuts system.
shortcuts
The 'new' shortcuts system has been in limbo for some time. I like it, but I never really 'finished' it, and there were still many places across the program that had hardcoded shortcuts. This week moves it forward, mostly for mouse clicks and the new mpv window. As a reminder, you can customise the system under file->shortcuts. There are multiple shortcut 'sets' that apply in different parts of the UI.
First of all, the shortcut edit UI has been rearranged so it is less of a mess. Instead of having all possible commands on the same window, you now select which one you want from a dropdown, and unnecessary widgets will be hidden. Also, the main dialog now lets you restore a shortcut set to default values.
Although mouse support remains limited, the windows that take mouse clicks can now catch more. Double-clicks are now recognised, and if you prefer the feel of a click up instead of down on certain actions, you can now differentiate between click 'press' and 'release'.
Next, the actual 'media windows' across the program, the image, animation, or mpv windows, are now plugged in to the shortcuts system. For now, this mostly means clicks. Left-clicking to pause/play is no longer hardcoded, and I have removed the default 'double-click -> open in an external program' (although you can add it back in as ctrl+double left-click or whatever you like) as this command is less important with mpv's audio and fast high-res scaling. There are two new shortcut sets--'media_viewer_media_window' and 'preview_media_window'--that have actions for pause, pause/play, open_externally, and close/launch_media_viewer. By default, middle-click or double left-click on the preview media window now launches the media viewer, just like on a thumbnail.
And the 'media_viewer_browser' set now has 'show_menu' as an action. It defaults to 'release right-click', but if you would prefer your menus on a click-press, or ctrl+release right-click or something, you can now change it. I expect to do this for the other important menus across the program as well. Also, most menus can now be opened with the context menu key on your keyboard, if you have it, so you might want to even remap right-click to something else.
The new 'global' shortcut set now has actions to exit and restart the application. They should be caught by the main gui window or any media viewer and work just like the actions on the file menu.
Most of the work this week was cleaning up behind the scenes code. I feel great about now extending it to more windows (such as thumbnails, to customise selection click shortcuts) and commands, and eventually planning advanced features like multi-actions so you can build pseudo-filters where a left-click is 'apply this tag, archive, and move to next file'. For now, I hope to slip in little bits of work here and there.
EDIT: A user let me know that the new double-click detection makes the archive/delete filter not work if you click too fast (it now detects the second click as different than a single-click and hence doesn’t map the ‘keep and move on’ etc.. action). I will fix this for next week, but in the meantime, if you are a fast clicker, please add additional shortcut mappings to ‘archive_delete_filter’ for double-click, and you should be working again.
the rest
I cleaned up some of the borked media-switching code I introduced to get mpv working. Transitioning from one media to another should have fewer instances of single-frame stretch. I am going to keep working here, because in some situations there is a single-frame of blank, which can be a bit of a flash.
The tag autocomplete dropdown window should be better at choosing when to hide and show.
I fixed a bug related to the advanced 'clear deleted tag record' command, which is usually fired by the tag migration window. The action was not properly clearing the cache that thumbnails use to fetch their tags, so while the deleted tag was deleted from the master database table, it did not appear so in UI. If you were hit by this, please run database->regenerate->autocomplete caches one time to resync yourself.
If you are a user who uses the parsing system, the string transformation panel has had a significant rework in the past two weeks. It hides/shows unneeded controls just like this week's shortcuts panel, and there is now a live preview of the current step's example and example-transformed text in the individual transformation rule edit dialog, which updates as you type, including showing regex errors! I expect in the near future to add the string transformation system to the filename tag panel soon, swapping out the jank old regex systems there for the nice full-featured converter.
full list
shortcuts:
the shortcut system now supports mouse double-clicks--left, right, or middle
the shortcuts system now differentiates between press or release single mouse clicks--although complete support for release mouse events may be a bit patchy, as full mouse integration is ongoing
the shortcut edit ui is now simpler--the command type is selected by a list, and the individual command sub-panels hide and show as appropriate--no more stupid 'set command' buttons
the shortcut edit ui now has a 'restore defaults' button that will restore an individual set back to default settings
two new shortcut sets are added--'media_viewer_media_window' and 'preview_media_window'. they control pause, pause/play, open_externally, and close/launch_media_viewer respectively. they work on the static image viewer, the native animation widget, and the new mpv player, and they support mouse clicks. the old pause/play (formerly left-click) and open_externally (double left-click) commands are no longer hardcoded
by default, the preview window's media window now launches the media viewer on a middle- or double-left-click
'media_viewer_browser' shortcut set now has 'release right-click' bound to 'show_menu', a new command, which is no longer hardcoded
most menus across the program can now be opened with the keyboard context menu key
the 'global' shortcut set now has 'exit_application', 'exit_application_force_maintenance', and 'restart_application' commands
fixed the rating increment/decrement command option not hiding in non-'media' shortcut sets
fixed some issues loading edit ui for shortcuts with rating actions
significant refactoring and some cleaning of shortcut code
.
the rest:
mpv windows should not longer get a single frame of previous-window-stretch when flicking between one mpv media to another with a different aspect ratio on the same media canvas. when a video is caught in a frame of loading, it should now flicker a frame of black
switching from one static image or native animation to another of the same type _should_ be less likely to do a single frame of stretch when transitioning. when an image or animation transition is caught on a new frame, it _should_ now flicker a frame the same colour as the media canvas background
the string transformation edit panel's individual transformation rule edit panel has had some more work: much like with shortcuts, the controls now hide and show based on transformation type, the controls' text labels now change based on transformation type, and the example text now updates on any widget change. the manual 'update example' button is removed
fixed a typo that caused an error when establishing the correct mouse cursor to use over the volume control when hydrus was using PyQt5 (rather than PySide2)
in order to reduce accidental micro-drags that cause mpv load-pause issues, starting a thumbnail drag now takes more pixels and requires a smoother drag to start, let's see how it goes
improved the show/hide logic of the floating autocomplete dropdown window. it should now also reliably detect when window focus goes from the dropdown itself to another window
fixed a bug where clearing the deletion record of a deleted tag would not remove the record from the fast cache that populates thumbnail tags (making it seem on most file loads that the tag still existed). if you were hit by this previously, please hit _database->regen->a/c cache_ one time to resync the cache
relatedly, thumbnails should now correctly live-update their deleted tags on deletion record clearance updates
if mpv is not available, opening the about window will now make a popup with the actual import error trace
significant refactoring of various ui code
next week
Next week is a 'small jobs' week. I have plenty to be getting on with, so I will just try to mix it up with a variety of fixing and improving work. I'd like to push on some more mpv issues like slideshow and custom .conf support in particular.
0 notes
hydrus · 6 years ago
Text
Version 373 (Qt)
youtube
windows
zip
exe
linux
tar.gz
source
tar.gz
The Qt update is ready for Windows and Linux!
This week's release is for all users, but please bear in mind it has some small layout and positioning bugs, such as subscription popups sizing a little strangely. If you would rather wait a week or two for these last issues to be cleared (and any others that pop up as more people play with this), that is totally fine.
Qt background
Since hydrus began as an application, it has used wxWidgets to draw all the windows and buttons on screen. wx has served us well, but hydrus has grown to be a complicated program with hundreds of different custom things going on, and it was starting to show. Lots of windows were flickery, modern tech like 4k screens were not excellently supported, and operating systems and window managers were unstable. If I could have moved to a more flexible and more frequently updated UI library by snapping my fingers, I would have, but the total UI code is almost three megabytes, far too much to reasonably convert as I kept at my normal weekly schedule.
A user contacted me I think about a year ago talking about Qt and possibly making some scripts to automatically convert hydrus's wx code to Qt. I said it sounded like a good idea, and he worked in the background trying to figure it out and add manual tweaks. He was very successful, ultimately getting an essentially functional build going a couple of months ago. He passed the code to me four weeks ago, and I have since crash-learned Qt and fixed the great majority of the bugs that slipped through the automatic conversion process.
I am extremely grateful for this user's work--this would not have happened otherwise--and I am very happy with the result. Qt is a nicer library than wx for our purposes, runs faster, has much less flicker and related jank, and provides many new options for future extensions and customisation. I also enjoy working with Qt--the library is good.
hydrus Qt
There are no critical differences between the wx and Qt builds. Every label and button is where it was before. Fonts and colours and sizes and margins are all slightly different, but nothing has been taken away. Also, there do not seem to be any dll-style conflicts with a previous installation, so you should just be able to install or extract as you would any other week without any problems.
One particularly nice thing is that Qt is overall faster. Video animations and thumbnail fading should be a little smoother. Another is that compatibility with different Linux distros is much better, so Linux users who have had crashes or drawing problems should now have an easier time.
Also, tag autocomplete dropdown result lists can now float for non-Windows. They can also float on dialogs like manage tags. Options on whether they should float or embed are now under options->gui.
Hydrus is a big program, however. I have done plenty of testing and fixed hundreds of things, and advanced users have tried out some early builds and helped me out more, but there are surely some odd layout and display bugs we have not found. There are also some that we found but I could not fix in time--for instance, sometimes the new page tab drag-and-drop does not do its new 'live' page navigation correctly, discord drag-and-drop file export is unreliable again, the duplicate filter's right-hand hover window sometimes positions incorrectly, and subscription popups will change size too often due to some unusual text handling as they work through their network jobs. If you encounter your own issues, I am interested in all feedback. For now, issues that affect usability are of higher priority than a couple of pixels out of place, but I am open to all reports.
If you use IME text input, let me know how it works for you now!
I regret that I was unable to get a release-ready macOS build out for today. macOS has some important UI differences to Windows and Linux, and there are still some significant things--like maximise/borderless fullscreen support for the media viewer--that were causing stability issues. I will keep at it next week.
Users who run from source will need qtpy and either PySide2 (default) or PyQt5. Check https://hydrusnetwork.github.io/hydrus/help/running_from_source.html for more information.
misc
I also did some normal work, mostly quality-of-life ui stuff:
The 'archive/delete' menu option now shows up when you have nothing selected, and will do everything.
Some of the system predicate edit panels now show quick-select buttons--for instance, if you hit 'system:duration', you'll now have two extra buttons for 'has duration' and 'no duration'.
I fixed an important CPU inefficiency in the new files maintenance manager that was affecting some users with large file maintenance queues and large gui sessions. It was causing juddery UI, which should be completely fixed now.
Clients with large sessions that include 'collected' media thumbnails with hundreds or thousands of files should experience less UI judder as they browse the files within those collections.
full list
qt:
hydrus now uses Qt for its client's user interface, migrating from wx. this is thanks to a huge effort by a user, who delivered converted code for hydrus dev to finish off
a number of hacks and patches remain to compensate for old systems, which hydrus dev will slowly clean up in normal work. ui bug and layout issue reports would be greatly appreciated
shortcut storage had to be converted from fixed wx enums to an independant system. there is a small chance that one of your shortcuts, particularly if it is on the numpad, may have been converted wrong (unusual Enter/Return buttons may be hit here). if one is not working, please check what hydrus thinks it is and try re-entering it
added tentative support for 'Mode_switch' keyboard modifier, for X11 users (and perhaps some users' AltGr?)
autocomplete results can now float in a popup window in dialogs like manage tags! they'll still embed by default, but there are now separate float/embed options for 'main gui' and 'other frame' a/cs
autocomplete results can now float in linux and macOS ok!
page drag and drop now navigates as you drag, so dropping into a page of pages works by you hovering over it and then dropping in the tabbar below, inserting exactly where you want the page to be
a couple of text inputs in the program--the watcher and gallery search pages' text inputs, particularly--now use nicer 'placeholder' text, which isn't real and only shows as grey text when the input is empty
for now, moved to icons for thumbnail 'has audio/duration' indicators, rather than the custom labels
to run the hydrus client from source, qtpy is now needed. either pyside2 (default) or qtpy5 is needed. QtCharts is optional. wx and matplotlib are no longer needed
.
misc:
'archive/delete filter' now appears even when no file is focused. it also appears when no files are selected--and will apply to everything
the system predicate edit panels now support static buttons for easy one-click select for common predicates. duration, has audio, limit, and num tags now have these
system:duration and system:num tags now render a special label if they are >0 or =0
system:untagged is now removed from the normal list
fixed a critical cpu inefficiency in the file maintenance manager's new always-on maintenance, which was lagging several users' browsing sessions while it was working
fixed ctrl+mousewheel tag autocomplete results navigation to skip over multirow parent results
fixed an issue where resetting to default bandwidth rules for a network context would not update the ui properly
fixed a bug when adding a parent/sibling from autocomplete results list
the serialised png export folder now catches when a manually inputted export path's directory does not exist
reduced metadata update lag of pages with very large media collection groups
the inaccurate 'add tags based on filename' button is now called 'import with tags'
fixed a database UNIQUE issue when two duplicate gui session save calls happen within one second
the server's lock_off command now works with the Hydrus-Key header auth (rather than hanging indefinitely wew)
the server now caches hashed access keys in the session manager, in memory, to avoid a db hit on access-key based reauthentication, and in instances where this authentication requires a db hit, now cleanly provides an appropriate 'serverbusy' error
improved some media object memory management and speedy cleanup
improved boot fail graceful exit
removed a bunch of defunct flash (swf) hacks from media viewer code
bunch of misc non-qt cleanup as I went through the code
fixed a bug with rendering network credentials for human display
cleared out the ancient tag archive sync advanced help and added a stub for the new tag migration window
various help updates around wx->Qt
next week
This took a lot of work, more than I thought. I am really pleased, but also exhausted. I am going to take an easy week of fixing little layout issues and try to add system tray minimisation and css theming (which will eventually lead to 'proper' nightmode or any other theme users can work out). I'll also see if I can get the macOS release working better.
Once the Qt-issues rush has eased, I will return to the big tag work and Mr. Bones' normal schedule. I'll also test out adding an mpv video player into the media viewer, so we finally have proper video (and audio!) support.
In the longer term, I have probably a hundred Qt-cleanup jobs to catch up on. There are many behind-the-scenes hacks to get wx-specific code to talk to Qt, so I need to clean up that old bad code into something neater. I will spread this work out into my normal schedule.
0 notes
pythonturkiye-blog · 8 years ago
Text
PyQt5 eğitimi
New Post has been published on http://www.python.tc/pyqt5-egitimi/
PyQt5 eğitimi
İyi günler arkadaşlar, bir yazı dizisi olarak benimde yeni öğrendiğim PyQt5 ile arayüz uygulama ile ilgili projeler ve eğitim derslerini vereceğim. Bu konuda gerçekten çok eksik var ve bu eksiği bizim gibi meraklı olan arkadaşların tembelliği yüzünden kapanmıyor.
Sizin için ufak 3 tane örnek paylaşacağım.
1.örnek combobox’a lineEdit ile veri ekleme
# -*- coding: utf-8 -*- from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(242, 302) self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(20, 130, 190, 45)) self.pushButton.setObjectName("pushButton") self.pushButton_3 = QtWidgets.QPushButton(Form) self.pushButton_3.setGeometry(QtCore.QRect(20, 180, 191, 61)) self.pushButton_3.setObjectName("pushButton_3") self.label = QtWidgets.QLabel(Form) self.label.setGeometry(QtCore.QRect(20, 10, 191, 51)) self.label.setObjectName("label") self.lineEdit = QtWidgets.QLineEdit(Form) self.lineEdit.setGeometry(QtCore.QRect(10, 80, 221, 33)) self.lineEdit.setObjectName("lineEdit") self.comboBox = QtWidgets.QComboBox(Form) self.comboBox.addItems(["Ahmet", "Mehmet", "Banu", "Konuray"]) self.comboBox.setGeometry(QtCore.QRect(10, 50, 221, 25)) self.comboBox.setObjectName("comboBox") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) self.pushButton.setText(_translate("Form", "ekle")) self.pushButton.clicked.connect(self.combo_add) self.pushButton_3.setText(_translate("Form", "kapat")) self.pushButton_3.clicked.connect(quit) self.label.setText(_translate("Form", "veriler ekleniyor")) def combo_add(self): if len(self.lineEdit.text()) >=3: self.comboBox.addItem(self.lineEdit.text()) self.label.setText(self.lineEdit.text()+" kişisi eklendi") else: self.label.setText("Kişi eklenemedi. En az 3 harfle oluşmalıdır") if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) Form = QtWidgets.QWidget() ui = Ui_Form() ui.setupUi(Form) Form.show() sys.exit(app.exec_())
  2.örnek listWidget’e lineEdit ile veri ekleme
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'x.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(535, 302) self.listWidget = QtWidgets.QListWidget(Form) self.listWidget.setGeometry(QtCore.QRect(50, 60, 256, 192)) self.listWidget.setObjectName("listWidget") list =self.listWidget list.addItem("Python") list.addItem("Php") list.addItem("javascript") list.addItem("c++") list.addItem("c") list.addItem("c#") self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(320, 130, 90, 33)) self.pushButton.setObjectName("pushButton") self.pushButton_2 = QtWidgets.QPushButton(Form) self.pushButton_2.setGeometry(QtCore.QRect(420, 130, 90, 33)) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtWidgets.QPushButton(Form) self.pushButton_3.setGeometry(QtCore.QRect(329, 190, 181, 61)) self.pushButton_3.setObjectName("pushButton_3") self.label = QtWidgets.QLabel(Form) self.label.setGeometry(QtCore.QRect(50, 10, 431, 31)) self.label.setObjectName("label") self.lineEdit = QtWidgets.QLineEdit(Form) self.lineEdit.setGeometry(QtCore.QRect(310, 70, 221, 33)) self.lineEdit.setObjectName("lineEdit") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) self.pushButton.setText(_translate("Form", "ekle")) self.pushButton.clicked.connect(self.list_add) self.pushButton_2.setText(_translate("Form", "sil")) self.pushButton_3.setText(_translate("Form", "kapat")) self.pushButton_3.clicked.connect(quit) self.label.setText(_translate("Form", "veriler ekleniyor")) def list_add(self): self.label.setText(self.lineEdit.text()+" eklendi") self.listWidget.addItem(self.lineEdit.text()) if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) Form = QtWidgets.QWidget() ui = Ui_Form() ui.setupUi(Form) Form.show() sys.exit(app.exec_())
  ve 3. örnek ise ufak bir önizleme programı
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'x.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets import sys class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(200, 250, 90, 33)) self.pushButton.setObjectName("pushButton") self.pushButton.clicked.connect(self.onizle) self.pushButton_2 = QtWidgets.QPushButton(Form) self.pushButton_2.setGeometry(QtCore.QRect(90, 250, 90, 33)) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_2.clicked.connect(quit) self.lineEdit = QtWidgets.QLineEdit(Form) self.lineEdit.setGeometry(QtCore.QRect(30, 50, 341, 101)) self.lineEdit.setObjectName("lineEdit") self.label = QtWidgets.QLabel(Form) self.label.setGeometry(QtCore.QRect(40, 170, 321, 51)) self.label.setObjectName("label") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) self.pushButton.setText(_translate("Form", "önizleme")) self.label.setText(_translate("Form", "üsteki yazı gelecek")) self.pushButton_2.setText(_translate("Form", "kapat")) def onizle(self): self.label.setText(self.lineEdit.text()) if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) Form = QtWidgets.QWidget() ui = Ui_Form() ui.setupUi(Form) Form.show() sys.exit(app.exec_())
  evet program kodları burada dediğim gibi bende yeni öğreniyorum. hem size yeni bir kaynak oluşturmak hemde kendimi anlatarak geliştirmek için bu yükün altına kendimi sokuyorum.İleri yazılarımda adım adım elemanların özelliklerini ve nasıl kullanıldığını anlatıp ilgili program kodlarını hem buradan hemde github üzerinden kaybolmaması için sizinle paylaşacağım.
Belki kendimi yeterli bir seviyede görürsem sizin için  eğitim videolarıda çekebilirim.
0 notes